<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html >
<html lang="en">
<head>
<%@include file="../../common/includeBaseSet.jsp" %>
<%@include file="../../common/includeSystemSet.jsp" %>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp" %>
<style type="text/css">
	a{cursor:pointer}
</style>
</head>
<body onload="getCusTagList()">
    <div class="page-content">
        <form id="baseForm" class="form-horizontal">
            <input type='hidden' class='pageNum' name='pageNum' value='1'/>
            <input type='hidden' class='pageSize' name='pageSize' value='10'/>
	        <div class="col-xs-12 panel panel-default">
	        	<div style="margin-top:1%">
		            <div class="col-xs-5">
		            	<div class="form-group">
		                    <label class="col-xs-3 control-label">项目:</label>
		                    <div class="col-xs-7">
		                        <select class="form-control" id="projectId" name="projectId">
		                        	<c:forEach items="${projectList}" var="list">
									    <option value="${list.id}">${list.projectName}</option>
								    </c:forEach>
								    <c:if test="${permitBtn == 'true'}">
								    	<option value="">全选</option>
								    </c:if>
		                        </select>
		                    </div>
		                </div>
		                <div class="form-group">
		                    <label class="col-xs-3 control-label">创建时间:</label>
                            <div class="col-xs-3">
                                 <input name="startCreateTime" id="startCreateTime" type="text" class="form-control" readonly="readonly" onClick="WdatePicker()" >
                            </div>
                            <div class="col-xs-3">
                                 <input name="endCreateTime" id="endCreateTime" type="text" class="form-control" readonly="readonly" onClick="WdatePicker()">
                            </div>
		                </div>
		                <div class="form-group">
                            <label class="col-xs-3 control-label">更新时间:</label>
                            <div class="col-xs-3">
                                 <input name="startUpdateTime" id="startUpdateTime" type="text" class="form-control" readonly="readonly" onClick="WdatePicker()" >
                            </div>
                            <div class="col-xs-3">
                                 <input name="endUpdateTime" id="endUpdateTime" type="text" class="form-control" readonly="readonly" onClick="WdatePicker()">
                            </div>
                        </div>
		            </div>
		            <div class="col-xs-5">
			            <div class="form-group">
		                    <label class="col-xs-3 control-label">经纪人:</label>
		                    <div class="col-xs-6">
		                        <input class="form-control" type="text" name="agentName" id="agentName" onkeydown="return ClearSubmit(event)"
		                        placeholder="可根据经纪人姓名模糊查询" onfocus="this.placeholder=''" onblur="this.placeholder='可根据经纪人姓名模糊查询'"/>
		                    </div>
		                </div>
		                <div class="form-group">
                            <label class="col-xs-3 control-label">客户姓名:</label>
                            <div class="col-xs-6">
                                <input class="form-control" type="text" name="cusName" id="cusName" onkeydown="return ClearSubmit(event)"
                                placeholder="可根据客户姓名模糊查询" onfocus="this.placeholder=''" onblur="this.placeholder='可根据客户人姓名模糊查询'"/>
                            </div>
                        </div>
		                <div class="form-group">
		                    <div style="margin-left:40px">
		                        <button id='searchBtn' class="btn btn-warning  btn-xs"  style="width:70px;"
		                            title="查询" type="button" onclick="JY.Page.jump('baseForm',1,'getCusTagList')">
		                            <i class="icon-search bigger-110 icon-only">搜索</i>
		                        </button>
		                    </div>
		                </div>
		            </div>
	            </div>
	        </div>
	    </form>
        <div class="col-xs-12">
            <table id="baseTable" class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">编号</th>
                        <th class="center">所属项目</th>
                        <th class="center">客户姓名</th>
                        <th class="center">联系电话</th>
                        <th class="center">新增标签数量</th>
                        <th class="center">修改标签数量</th>
                    </tr>
                </thead>
                <tbody><!-- 内容 --></tbody>
            </table>
            <div class="row">
                <div class="col-sm-8">
                    <!--设置分页位置-->
                    <div id="pageing" class="dataTables_paginate paging_bootstrap">
                        <ul class="pagination"></ul>
                    </div>
                </div>
            </div>
        </div>
        <!-- #dialog-confirm -->
        <%@include file="../../common/dialog.jsp"%>
    </div>
</body>
<script type="text/javascript">

	//查询列表
	function getCusTagList(){
		var loadIndex = layer.load(1, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });
		JY.Ajax.doRequest("baseForm",jypath +'/customer/customerProjectQuestion/cusTagList',null,function(data){
            $("#baseTable tbody").empty();
            var page = data.obj;
            //分页数据
            var pageNum = page.pageNumber, pageSize = page.pageSize, totalRecord = page.total;
            var html = "";
            var results = page.rows;
            if(results == null || results.length <= 0){
            	html+="<tr><td colspan='8' class='center'>没有相关数据</td></tr>";
                $("#baseTable tbody").append(html);
                $("#pageing ul").empty();//清空分页
                layer.closeAll('loading');
                return false;
            }
          
            var leng=(pageNum-1)*pageSize;//计算序号
            for(var i = 0;i<results.length;i++){
                var info = results[i];
                
                html += "<tr>";
                html += "<td class='center'>" + (leng + i + 1) + "</td>";
                html += "<td class='center'>" + info.projectName + "</td>";
                html += "<td class='center'>" + info.customerName + "</td>";
                html += "<td class='center'>" + info.customerPhone + "</td>";
                html += "<td class='center' onclick='toCusTag("+info.customerId+","+info.projectId+")'><a>" + info.createTimeNum + "</a></td>";
                html += "<td class='center' onclick='toCusTag("+info.customerId+","+info.projectId+")'><a>" + info.updateTimeNum + "</a></td>";
                html += "</tr>";
            }
            $("#baseTable tbody").append(html);
            JY.Page.setPage("baseForm","pageing",pageSize,pageNum,totalRecord,"getCusTagList");
            layer.closeAll('loading');
		});
	}
	//跳转客户标签
	function toCusTag(customerId, projectId){
		location.href = jypath + "/customer/customerProjectQuestion/toCusTagPage?customerId="+customerId+"&projectId="+projectId;
	}
	
	//解决选中input框按回车时会刷新页面的问题
	function ClearSubmit(e) {
        if (e.keyCode == 13) {
            return false;
        }
	}
</script>
</html>